/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.mappingtable.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import uimigration.mappingtable.MappingActionEvent;
import uimigration.mappingtable.MappingBehaviourEvent;
import uimigration.mappingtable.MappingPositionningProperties;
import uimigration.mappingtable.MappingTable;
import uimigration.mappingtable.MappingtablePackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Mapping Table</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link uimigration.mappingtable.impl.MappingTableImpl#getName <em>Name</em>}</li>
 *   <li>{@link uimigration.mappingtable.impl.MappingTableImpl#getEventsAction <em>Events Action</em>}</li>
 *   <li>{@link uimigration.mappingtable.impl.MappingTableImpl#getEventsBehaviors <em>Events Behaviors</em>}</li>
 *   <li>{@link uimigration.mappingtable.impl.MappingTableImpl#getPropertiesBehaviors <em>Properties Behaviors</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MappingTableImpl extends EObjectImpl implements MappingTable {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The cached value of the '{@link #getEventsAction() <em>Events Action</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEventsAction()
	 * @generated NOT
	 * @ordered
	 */
	protected EList<MappingActionEvent> eventsAction;

	/**
	 * The cached value of the '{@link #getEventsBehaviors() <em>Events Behaviors</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEventsBehaviors()
	 * @generated NOT
	 * @ordered
	 */
	protected EList<MappingBehaviourEvent> eventsBehaviors;

	/**
	 * The cached value of the '{@link #getPropertiesBehaviors() <em>Properties Behaviors</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPropertiesBehaviors()
	 * @generated  NOT
	 * @ordered
	 */
	protected EList<MappingPositionningProperties> propertiesBehaviors;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MappingTableImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return MappingtablePackage.Literals.MAPPING_TABLE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					MappingtablePackage.MAPPING_TABLE__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public EList<MappingActionEvent> getEventsAction() {
		if (eventsAction == null) {
			eventsAction = new EObjectContainmentEList<MappingActionEvent>(
					MappingActionEvent.class, this,
					MappingtablePackage.MAPPING_TABLE__EVENTS_ACTION);
		}
		return eventsAction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public EList<MappingBehaviourEvent> getEventsBehaviors() {
		if (eventsBehaviors == null) {
			eventsBehaviors = new EObjectContainmentEList<MappingBehaviourEvent>(
					MappingBehaviourEvent.class, this,
					MappingtablePackage.MAPPING_TABLE__EVENTS_BEHAVIORS);
		}
		return eventsBehaviors;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public EList<MappingPositionningProperties> getPropertiesBehaviors() {
		if (propertiesBehaviors == null) {
			propertiesBehaviors = new EObjectContainmentEList<MappingPositionningProperties>(
					MappingPositionningProperties.class, this,
					MappingtablePackage.MAPPING_TABLE__PROPERTIES_BEHAVIORS);
		}
		return propertiesBehaviors;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case MappingtablePackage.MAPPING_TABLE__EVENTS_ACTION:
			return ((InternalEList<?>) getEventsAction()).basicRemove(otherEnd,
					msgs);
		case MappingtablePackage.MAPPING_TABLE__EVENTS_BEHAVIORS:
			return ((InternalEList<?>) getEventsBehaviors()).basicRemove(
					otherEnd, msgs);
		case MappingtablePackage.MAPPING_TABLE__PROPERTIES_BEHAVIORS:
			return ((InternalEList<?>) getPropertiesBehaviors()).basicRemove(
					otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case MappingtablePackage.MAPPING_TABLE__NAME:
			return getName();
		case MappingtablePackage.MAPPING_TABLE__EVENTS_ACTION:
			return getEventsAction();
		case MappingtablePackage.MAPPING_TABLE__EVENTS_BEHAVIORS:
			return getEventsBehaviors();
		case MappingtablePackage.MAPPING_TABLE__PROPERTIES_BEHAVIORS:
			return getPropertiesBehaviors();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	@SuppressWarnings("unchecked")
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case MappingtablePackage.MAPPING_TABLE__NAME:
			setName((String) newValue);
			return;
		case MappingtablePackage.MAPPING_TABLE__EVENTS_ACTION:
			getEventsAction().clear();
			getEventsAction().addAll((Collection<? extends MappingActionEvent>) newValue);
			return;
		case MappingtablePackage.MAPPING_TABLE__EVENTS_BEHAVIORS:
			getEventsBehaviors().clear();
			getEventsBehaviors().addAll((Collection<? extends MappingBehaviourEvent>) newValue);
			return;
		case MappingtablePackage.MAPPING_TABLE__PROPERTIES_BEHAVIORS:
			getPropertiesBehaviors().clear();
			getPropertiesBehaviors().addAll((Collection<? extends MappingPositionningProperties>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
		case MappingtablePackage.MAPPING_TABLE__NAME:
			setName(NAME_EDEFAULT);
			return;
		case MappingtablePackage.MAPPING_TABLE__EVENTS_ACTION:
			getEventsAction().clear();
			return;
		case MappingtablePackage.MAPPING_TABLE__EVENTS_BEHAVIORS:
			getEventsBehaviors().clear();
			return;
		case MappingtablePackage.MAPPING_TABLE__PROPERTIES_BEHAVIORS:
			getPropertiesBehaviors().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case MappingtablePackage.MAPPING_TABLE__NAME:
			return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT
					.equals(name);
		case MappingtablePackage.MAPPING_TABLE__EVENTS_ACTION:
			return eventsAction != null && !eventsAction.isEmpty();
		case MappingtablePackage.MAPPING_TABLE__EVENTS_BEHAVIORS:
			return eventsBehaviors != null && !eventsBehaviors.isEmpty();
		case MappingtablePackage.MAPPING_TABLE__PROPERTIES_BEHAVIORS:
			return propertiesBehaviors != null
					&& !propertiesBehaviors.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(')');
		return result.toString();
	}

} //MappingTableImpl
